package top.v5it.japi.plus.common.tuple;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * 四元组
 *
 * @author zhanpu
 * @date 2022/6/15
 */
@Getter
@EqualsAndHashCode(callSuper = false)
public class Tuple4<T1, T2, T3, T4> extends Tuple3<T1, T2, T3> {

    private static final long serialVersionUID = -2849649822609576068L;
    final T4 four;

    Tuple4(T1 one, T2 two, T3 three, T4 four) {
        super(one, two, three);
        this.four = four;
    }

    @Override
    public Object[] toArray() {
        return new Object[]{this.one, this.two, this.three, this.four};
    }

    @Override
    public int size() {
        return 4;
    }

    @Override
    public Object get(int index) {
        switch (index) {
            case 0:
                return this.one;
            case 1:
                return this.two;
            case 2:
                return this.three;
            case 3:
                return this.four;
            default:
                return null;
        }
    }
}
